package com.example.asus.imtao.Fragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.asus.imtao.Adapter.MainHeaderAdAdapter;
import com.example.asus.imtao.R;
import com.example.asus.imtao.Util.DataUtil;


/**
 * 主视图Fragment
 *
 */
public class MainFragment extends Fragment {

    protected ViewPager mVpagerHeaderAd;//广告头部
    protected int[] icons = {R.mipmap.header_pic_ad1,R.mipmap.header_pic_ad2,R.mipmap.header_pic_ad1};
    protected int[] menuIcons = {};
    protected RecyclerView mRecycleViewManu;//主菜单

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_main,container,false);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        mVpagerHeaderAd = (ViewPager) getView().findViewById(R.id.vpager_main_header_ad);
        mRecycleViewManu = (RecyclerView) getView().findViewById(R.id.recycleView_main_menu);

        MainHeaderAdAdapter adAdapter = new MainHeaderAdAdapter(getActivity(), DataUtil.getHeaderAddInfo(getActivity(),icons));
        mVpagerHeaderAd.setAdapter(adAdapter);
    }
}
